package com.thoughtworks;

import java.util.List;

public class HelperFunctions {
    DataProvider dataProvider = new DataProvider();
    List<Dish> dishes = dataProvider.getDishes();

    public int findItemPrice(String id) {
        if(id==null){
            return 1111;
        }
        for(Dish dish: dishes) {
            if(id.equals(dish.getId())) {
                return (int) dish.getPrice();
            }
        }
        return 0;
    }

    public String findItemName(String id) {
        if(id==null){
            return "is null";
        }
        for(Dish dish: dishes) {
            if(id.equals(dish.getId())) {
                return dish.getName();
            }
        }
        return "not found";
    }

}
